﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WuxiWTO.Mapping;
using WutiWTO.Common;
using System.Data.Linq;

namespace WuxiWTO.Web.backend
{
    public partial class validateUser : BasePage
    {
        WTODataContext contex = new WTODataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnValidate_Click(object sender,EventArgs e)
        {
            int supporter_id = Convert.ToInt32(Request.QueryString["id"]);
            supporter cat = contex.supporters.SingleOrDefault(p => p.supporter_id == supporter_id);
            if (cat != null)
            {
                if (Session["admin_type"].ToString() != "1")
                {
                    //if (cat.purpose != Session["admin_type"].ToString())
                    //{
                       // ClientScript.RegisterStartupScript(this.GetType(), "fa2", "alert('您没有权限进行当前操作');", true);
                    //}
                }
                cat.is_active = 'F';//驳回
                cat.validate_reason = this.txtReason.Text.Trim();
                contex.SubmitChanges();
                ClientScript.RegisterStartupScript(this.GetType(), "fa2", "window.close();window.opener.location = 'userList.aspx';", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "fa2", "alert('参数传递失败');", true);
            }
        }
    }
}